package org.example.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author 22449
 */
@Configuration
public class RabbitMqConfig {

    public static final String COOKIE_QUEUE = "getCookieList";

    public static final String COOKIE_EXCHANGE = "getCookieList";

    public static final String COOKIE_ROUTING_KEY = "getCookieList.";

    @Bean
    public Queue cookieQueue(){
        return new Queue(COOKIE_QUEUE);
    }

    @Bean
    public TopicExchange cookieExchange(){
        return new TopicExchange(COOKIE_EXCHANGE);
    }

    @Bean
    public Binding cookieBinding(){
        return BindingBuilder.bind(cookieQueue()).to(cookieExchange()).with(COOKIE_ROUTING_KEY+"#");
    }


    public static final String POST_QUEUE = "postCacheList";

    public static final String POST_EXCHANGE = "postCacheList";

    public static final String POST_ROUTING_KEY = "postCacheList.";

    @Bean
    public Queue postCacheQueue(){
        return new Queue(POST_QUEUE);
    }

    @Bean
    public TopicExchange postCacheExchange(){
        return new TopicExchange(POST_EXCHANGE);
    }

    @Bean
    public Binding postCacheBinding(){
        return BindingBuilder.bind(postCacheQueue()).to(postCacheExchange()).with(POST_ROUTING_KEY+"#");
    }







}
